package com.qk.entity;

import com.qk.common.enums.AvatarStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Avatar {
    private Long id;
    private Long userId;
    private String filePath;
    private String fileMd5;
    private Integer isGarbage;
    private LocalDateTime createTime;
    private LocalDateTime markTime;
    public boolean isGarbage() {
        return AvatarStatus.GARBAGE.getCode() == this.isGarbage;
    }
    public void markAsGarbage() {
        this.isGarbage = AvatarStatus.GARBAGE.getCode();
        this.markTime = LocalDateTime.now();
    }
    public void markAsActive() {
        this.isGarbage = AvatarStatus.ACTIVE.getCode();
        this.markTime = null;
    }
}